#include<iostream>
#include<queue>
#include<algorithm>
const int N = 1e6 + 10;
int ti[N],num[N];
bool pe[N];
using namespace std;
queue<int> st;
queue<int> dt;
int main()
{
	int g,n,count = 0,t = 1e9; cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> ti[i];
		t = min(t, ti[i]);
		 if(i == 1)g = i;
		cin >> num[i];
		if (ti[i] - t >= 86400)
		{
			count = 0;
			for(int j = 1; j <= num[g]; j++)
			{
				pe[st.front()] = false;
				st.pop();
			}
			t = ti[g + 1];
			g = g + 1;
		}
		for (int j = 1; j <= num[i]; j++)
		{
			int p;cin >> p;
			st.push(p);
		}
		dt = st;
		while (dt.size())
		{
			if (pe[dt.front()] == false)
			{
				count++;
				pe[dt.front()] = true;
			}
			dt.pop();
		}
		cout << count << endl;
	}
	return 0;
}